/**
 * @description 同步等待
 * @param {number} duration 时长，毫秒
 * @returns {Promise} Promise
 */
export default function delay(duration = 0) {
	return new Promise((resolve) => {
		let timer = setTimeout(() => {
			resolve();
			clearTimeout(timer);
		}, duration);
	});
}
